<?php
namespace app\admin\validate;

use think\Validate;

class Cate extends Validate
{
         protected $rule =   [
            'cate_name'  => 'require|max:30|unique:cate',
            'model_id'   => 'require|number',
            'pid' =>'require|number',
            'cate_attr' =>'require|number',
        ];

        protected $message  =   [
           'cate_name.require' =>'栏目名称不得为空！',
           'cate_name.max'   =>'栏目名称不得超过30个字符',
           'cate_name.unique' =>'栏目名称不得重复',

           'model_id.require' => '所属模型不得为空！',
           'model_id.number' =>'所属模型必须是数字',

           'pid.require' => '上级栏目不得为空！',
           'pid.number' =>'上级栏目必须是数字',

           'cate_attr.require' => '栏目属性不得为空！',
           'cate_attr.number' =>'栏目属性必须是数字',

        ];

        protected $scene = [
            'edit'  =>  ['cate_name','model_id','pid','cate_attr'],
            'add'  =>  ['cate_name','model_id','pid','cate_attr'],
        ];

}












?>